/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       standardmaterial.h
 * Author:     karooolek
 * Created on: 2009-03-14
 *
 **********************************************************************************************************************/

#ifndef STANDARDMATERIAL_H_
#define STANDARDMATERIAL_H_

#include "material.h"
#include "gpuprogram.h"
#include "../common.h"

namespace mGameEngine
{
namespace Graphics
{

/**
 * Material for standard (Blinn) lighting model.
 * Defines ambient, diffuse, specular and emmisive light reflection.
 */
class StandardMaterial: public Material
{
protected:
    /**
     * Ambient color
     */
    Color _ambient;

    /**
     * Diffuse color
     */
    Color _diffuse;

    /**
     * Specular color
     */
    Color _specular;

    /**
     * Shininess
     */
    float _shininess;

    /**
     * Emissive color
     */
    Color _emissive;

public:
    /**
     * Create new material with initial values.
     * @param ambient ambient color
     * @param diffuse diffuse color
     * @param specular specular color
     * @param shininess shininess
     * @param emissive emissive color
     */
    StandardMaterial(const Color & ambient = Color(1.0f, 1.0f, 1.0f),
            const Color & diffuse = Color(1.0f, 1.0f, 1.0f),
            const Color & specular = Color(0.0f, 0.0f, 0.0f),
            float shininess = 0.0f,
            const Color & emissive = Color(0.0f, 0.0f, 0.0f));

    /**
     * Destroy standard material.
     */
    virtual ~StandardMaterial();

    /**
     * Get ambient color.
     * @return ambient color
     */
    const Color &getAmbientColor() const
    {
        return _ambient;
    }

    /**
     * Set ambient color.
     * @param ambient ambient color
     */
    void setAmbientColor(const Color &ambient)
    {
        _ambient = ambient;
    }

    /**
     * Get diffuse color.
     * @return diffuse color
     */
    const Color &getDiffuseColor() const
    {
        return _diffuse;
    }

    /**
     * Set diffuse color.
     * @param diffuse diffuse color
     */
    void setDiffuseColor(const Color &diffuse)
    {
        _diffuse = diffuse;
    }

    /**
     * Get specular color.
     * @return specular color
     */
    const Color &getSpecularColor() const
    {
        return _specular;
    }

    /**
     * Set specular color.
     * @param specular specular color
     */
    void setSpecularColor(const Color &specular)
    {
        _specular = specular;
    }

    /**
     * Get shininess.
     * @return shininess
     */
    float getShininess() const
    {
        return _shininess;
    }

    /**
     * Set shininess.
     * @param shininess shininess
     */
    void setShininess(float shininess)
    {
        _shininess = shininess;
    }

    /**
     * Get emissive color.
     * @return emissive color
     */
    const Color &getEmissiveColor() const
    {
        return _emissive;
    }

    /**
     * Set emissive color.
     * @param emissive emissive color
     */
    void setEmissiveColor(const Color &emissive)
    {
        _emissive = emissive;
    }

    /**
     * Set standard material as active.
     */
    virtual void set() const;
};

}
}

#endif // STANDARDMATERIAL_H_
